package com.mihuo.controller;

import com.mihuo.entity.annotation.Anonymous;
import com.mihuo.entity.common.R;
import com.mihuo.entity.dto.AccountLoginDTO;
import com.mihuo.service.IAppUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "登录")
@RestController
@RequestMapping("/login")
public class LoginController {

    @Resource
    private IAppUserService userService;

    @Anonymous
    @ApiOperation("账号密码登录")
    @PostMapping("/account")
    public R<?> accountLogin(@Validated @RequestBody AccountLoginDTO dto){
        return R.success(userService.accountLogin(dto));
    }
}
